#!/bin/bash

### if else 结构演示

echo "Is it morning? Please input 'yes' or 'no'"
read ans

#if [[ "yes" == $ans ]]; then
if [ "yes" = $ans ]; then
    echo "Good morning"
else
    echo "Good afternoon"
fi

if test -f /etc/passwd; then
    echo "file '/etc/passwd' exists"
else
    echo "file '/etc/passwd' not exist"
fi

## 演示使用[[]] 扩展进行算术比较
a=5
b=4
if [[ $a > $b ]]; then
    echo "$a>$b"
else
    echo "$a<$b"
fi
